import React from 'react'
import { Radio } from 'antd'
import EnhanceSelectEmployee from 'components/template/enhance-select-employee/index'

const RadioGroup = Radio.Group;

export default {
  key: 'enhance-select-employee',
  name: 'EnhanceSelectEmployee ',
  author: '王家坤',
  description: '重写SelectEmployeeGroup组件所有功能，并对其内部功能提供给外接配置属性，扩大组件使用范围',
  isExampleFull: true,
  api: [
    {
      title: 'API',
      data: [{
        param: 'mode', description: 'mode是一个对象只有两属性::key和::label，key对应CheckBox得value属性，label则是显示属性', type: 'Object', defaultValue: '-'
      }, {
        param: 'newUrl', description: 'newUrl为请求接口地址', type: 'String', defaultValue: '/api/user/groups/company?page=0&size=1000'
      }, {
        param: 'value', description: '设置初始值，对应mode中的key值属性(比如{key:\'id\'},url返回对象{id:\'ss34dds\'})值，则value为[\'ss34dds\']', type: 'Array', defaultValue: '-'
      }, {
        param: 'modalTitle', description: '弹框标题。', type: 'String', defaultValue: '选择人员组'
      }, {
        param: 'checkItemRender', description: '自定义显示CheckBox项', type: 'func(item){return element}', defaultValue: '-'
      }, {
        param: 'disabledKey', description: '设置根据数据中的哪个字段对选项进行禁用或者自定义条件禁用，返回值为布尔类型', type: 'String / func(item){return boolean}', defaultValue: '-'
      }, {
        param: 'entity', description: 'true，返回所选完整数据对象数组，false，返回所选数据的::mode中::key对应的值数组。', type: 'boolean', defaultValue: 'false'
      }, {
        param: 'onOk', description: '弹框::OK回调，如果设置了则不再是表单组件，不设置默认为表单组件，必须与::form一起使用。', type: 'func(values){return selectedData}', defaultValue: '-'
      }],
      description: '下列属性只有mode为必填项。'
    }
  ],
  example: [
    {
      title: '基础用法',
      description: '默认原SelectEmployeeGroup组件功能，只需配置mode即可',
      state: {
        mode:{
          label:'name',
          key:'userGroupOID'
        }
      },
      getMethod: context => {
        return {
          handleOnOk: value => {
            console.log(value)
          }
        }
      },
      getContent: context => {
        const { mode } = context.state;
        return (
          <div>
            <EnhanceSelectEmployee
              mode={mode}
              onOk={context.handleOnOk}
            />
          </div>
        )
      }
    }
  ]
}
